
$(document).ready(function()
{
	$('select#editionSelect').change(function()
	{
		if ($(this).selectedValues() != 0)
		{
			$('input#bookEan13Snd').attr('disabled',true);
			$('input#bookYearSnd').attr('disabled',true);
			$('input#bookPriceSnd').attr('disabled',true);
			$('select#publisherListSnd').attr('disabled',true);
		}
		else
		{
			$('input#bookEan13Snd').removeAttr('disabled');
			$('input#bookYearSnd').removeAttr('disabled');
			$('input#bookPriceSnd').removeAttr('disabled');
			$('select#publisherListSnd').removeAttr('disabled');
		}
	});
	

	$('a#addDrawer').click(function()
	{
		var drawerP = $('#drawerP');
		drawerPClone= drawerP.clone(true);
		drawerPClone.attr('class','field half removable');
		drawerPClone.insertAfter(drawerP);
	});

	$('a#addScriptWritter').click(function()
	{
		var scriptWritterP = $('#scriptWritterP');
		var scriptWritterPClone = scriptWritterP.clone(true);
		scriptWritterPClone.attr('class','field half removable');
		scriptWritterPClone.insertAfter(scriptWritterP);
		
	});
	
	$('a#removeAllFields').click(function()
	{
		$('.removable').remove();
	});
	
	$('.confirmAction').click(function(e)
	{
		e.preventDefault();
		var idAlbum = $(this).attr('id');
		var content = '<center><strong>Attention</strong> vous &ecirc;tes sur le point de supprimer un album de la collection. Cette action est irreversible ! <br /><br /> <strong>Souhaitez vous continuer ?</strong>';
		content +=	'<form action="'+urlBdbdec+'/bdbdec.php?action=deleteBook" method="post"><input type="submit" value="Oui" name="yes">&nbsp;&nbsp;&nbsp;&nbsp;<input type="submit" value="Non" name="no" class="nyroModalClose"><input type="hidden" value="'+idAlbum+'" name="idAlbum"></form><br /><small><a href="#" class="nyroModalClose">Retour</a><small></center>';
		
		
		
		$.fn.nyroModalManual({
			content: content,
			showBackground: showBackgroundBDBDEC,
			hideBackground: hideBackgroundBDBDEC,
			showContent: showContentBDBDEC,
			hideContent: hideContentBDBDEC,
			bgColor: '#cfe3ef',
			css: { 
				bg: {
				  zIndex: 100,
				  position: 'fixed',
				  top: 0,
				  left: 0,
				  height: '100%',
				  width: '100%'
				},
				wrapper: {
				  zIndex: 101,
				  position: 'fixed',
				  top: '50%',
				  left: '50%',
				  paddingLeft : '20px',
				  paddingRight : '20px'
				},
				wrapper2: {
				},
				content: {
				  overflow: 'hidden'
				},
				loading: {
				  zIndex: 102,
				  position: 'fixed',
				  top: '50%',
				  left: '50%',
				  marginTop: '-50px',
				  marginLeft: '-50px'
				}
			  }
			});
		return false;
	});
});
